export function timeDifference(timestamp) {
  const now = new Date();
  const inputTime = new Date(timestamp);
  const diffInSeconds = Math.floor((now - inputTime) / 1000);

  if (diffInSeconds < 60) {
    return '1分钟';
  } else if (diffInSeconds < 3600) {
    return Math.floor(diffInSeconds / 60) + '分钟';
  } else if (diffInSeconds < 86400) {
    return Math.floor(diffInSeconds / 3600) + '小时';
  } else if (diffInSeconds < 2592000) {
    return Math.floor(diffInSeconds / 86400) + '天';
  } else if (diffInSeconds < 7776000) {
    return Math.floor(diffInSeconds / 2592000) + '月';
  } else {
    return null;s
  }
}

export function gotoHome(){
	uni.showModal({
		title:"提示",
		content:"页面有误，将返回首页",
		showCancel:false,
		success:(res)=>{
			if(res.confirm == true){
				uni.reLaunch({
					url:"/pages/index/index"
				})
			}
		}
	})
}
